﻿using System.Windows.Controls;
using Microsoft.Windows.Controls;

namespace Might.UIControls.DomBrowser {
    public partial class DomBrowserView : IDomBrowserView {
        public DomBrowserView() {
            InitializeComponent();
        }

        public void AddTreeRoot(TreeViewItem root) {
            addTreeItems(root, DOMTree.Items);
        }

        public void AddTreeItem(TreeViewItem item, TreeViewItem toItem) {
            addTreeItems(item, toItem.Items);
        }

        private void addTreeItems(TreeViewItem item, ItemCollection toCollection) {
            item.IsExpanded = false;

            toCollection.Add(item);

            /*            foreach( TreeViewItem childItem in item.Items ) {
                addTreeItems( childItem , item.Items );
            }
*/
        }
    }
}
